<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }

        a {
            text-decoration: none;
            color: inherit;
        }

        li {
            list-style: none;
        }

        img {
            vertical-align: top;
        }

        #showGoods {
            width: 1226px;
            margin: 0 auto;
            margin-top: 50px;
            display: flex;
            flex-wrap: wrap;
            justify-content: space-between;
        }

        #showGoods li {
            width: 18%;
            box-sizing: border-box;
            padding: 10px;
            font-size: 13px;
            line-height: 20px;
        }

        #showGoods li:hover {
            box-shadow: 0 0 1px 2px rgba(0, 0, 0, 0.2);
        }

        #showGoods li img {
            width: 70%;
            display: block;
            margin: 20px auto;
        }

        #showGoods li .price {
            color: red;
        }

        #showGoods li .name {
            /* 多行文本溢出隐藏 */
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 2;
            overflow: hidden;
            text-overflow: ellipsis;
        }
    </style>
</head>

<body>
    <h3><%= title %></h3>
    <ul id="showGoods">
        <!-- 后端拿到数据之后 编译ejs文件 -> 将编译后的内容输出到前端 -->
        <%  list.forEach(function(item){  %>
            <li>
                <a href="">
                    <img src="<%= item.goodsImg %>"
                        alt="">
                    <div class="price"><%= item.goodsPrice %></div>
                    <div class="name"><%= item.goodsName %></div>
                    <div class="comment"><%= item.commentCount %></div>
                    <div class="shop"><%= item.shopName %></div>
                </a>
            </li>
        <% })%>
    </ul>
</body>


</html>